In-lane vector shuffle instructions

ABSTRACT

In-lane vector shuffle operations are described. In one embodiment a shuffle instruction specifies a field of per-lane control bits, a source operand and a destination operand, these operands having corresponding lanes, each lane divided into corresponding portions of multiple data elements. Sets of data elements are selected from corresponding portions of every lane of the source operand according to per-lane control bits. Elements of these sets are copied to specified fields in corresponding portions of every lane of the destination operand. Another embodiment of the shuffle instruction also specifies a second source operand, all operands having corresponding lanes divided into multiple data elements. A set selected according to per-lane control bits contains data elements from every lane portion of a first source operand and data elements from every corresponding lane portion of the second source operand. Set elements are copied to specified fields in every lane of the destination operand.

FIELD OF THE INVENTION

The invention relates to computer systems, and in particular, to anapparatus and method for performing multi-dimensional computations usingan in-lane shuffle operation.

BACKGROUND

A Single Instruction, Multiple Data (SIMD) architecture improvesefficiency of multi-dimensional computations. Implemented in computersystems, the SIMD architecture enables one instruction to operate ondata simultaneously, rather than on a single data. In particular, SIMDarchitectures take advantage of packing many data elements within oneregister or memory location. With parallel hardware execution, multipleoperations can be performed with one instruction, resulting insignificant performance improvement.

Although many applications currently in use can take advantage of suchoperations, known as vertical operations, there are a number ofimportant applications which require the rearrangement of the dataelements before vertical operations can be implemented so as to providerealization of the application. Examples of some important applicationsinclude the dot product and matrix multiplication operations, which arecommonly used in 3-D graphics and signal processing applications.

One problem with rearranging the order of data elements within aregister or memory word is the mechanism used to indicate how the datashould be rearranged. Typically, a mask or control word is used. Thecontrol word must include enough bits to indicate which of the sourcedata fields must be moved into each destination data field. For example,if a source operand has eight data fields, requiring three bits todesignate any given data field, and the destination register has fourdata fields, (3×4) or 12 bits are required for the control word.However, on a processor implementation where there are less than 12 bitsavailable for the control register, a full shuffle cannot be supported.Some approaches addressing such issues were presented, for example, inU.S. Pat. No. 6,041,404 and in U.S. Pat. No. 7,155,601.

The problem described above is made worse though, when even more datafields are permitted in the sources and destinations. Moreover thecomplexity of circuitry required to shuffle data and to control saidshuffling can increase proportional to the square of the number ofpermitted data fields causing undesirable delays, costing precious diearea, and consuming ever more power. Therefore, there is a need for away to reorganize the order of data elements where less than the fullnumber of bits is available for a control register in such a way as toscale to handle operands where even more data fields are permitted.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention will be described in detail with reference to thefollowing drawings in which like reference numerals refer to likeelements wherein:

FIG. 1 illustrates an exemplary computer system in accordance with oneembodiment of the invention;

FIGS. 2 a to 2 c illustrate flow diagrams for processes to performshuffle instructions according to a set of embodiments of the invention;

FIGS. 3 a to 3 b illustrate flow diagrams for processes to performshuffle instructions according to a set of alternative embodiments ofthe invention;

FIG. 4 illustrates an example of a field of per-lane control bits;

FIGS. 5 a to 5 c illustrate the operation of the shuffle instructions inaccordance with embodiments of the invention.

FIGS. 6 a to 6 b illustrate the operation of the shuffle instructions inaccordance with alternative embodiments of the invention.

DETAILED DESCRIPTION

In-lane vector shuffle operations are described herein. In embodimentsof a shuffle operation, sets of data elements are selected fromcorresponding portions of each lane of a source operand according toper-lane control bits and copied to specified fields in correspondingportions of each lane of a destination operand. Other embodiments of theshuffle instruction specify two source operands, all operands havingcorresponding lanes divided into multiple data elements. Data elementsselected according to per-lane control bits include data elements fromeach lane portion of a first source operand and include data elementsfrom each corresponding lane portion of a second source operand, whichare copied to specified fields in corresponding lanes of the destinationoperand.

The shuffle instruction has useful applications in data reorganizationand in moving data into different locations of the register to allow,for example, extra storage for scalar operations, manipulation ofcomplex numbers that require transforms, or to facilitate conversionbetween data formats such as from packed integer to packed floatingpoint and vice versa. Such application in the technical arts include butare not limited to motion video compression/decompression, imagefiltering, audio signal compression, filtering or synthesis,modulation/demodulation, etc. Data formats of certain particular data orsignal types such as audio or motion video for example, which arerepresentative of or constitute communication, physical activity orobjects often have regular structures and component data elements whichcan be manipulated or transformed in substantially similar ways for eachlane of a source operand. Thus shuffling data elements according to afield of per-lane control bits is applicable to such data or signaltypes.

In the following description, numerous specific details are set forth toprovide a thorough understanding of the invention. However, it will beunderstood by one of ordinary skill in the art that the invention may bepracticed without these specific details. In other instances, well-knowncircuits, structures and techniques have not been shown in detail inorder not to obscure the invention.

FIG. 1 illustrates one of many embodiments of a computer system 100which implements the principles of the present invention. Computersystem 100 comprises a processor 105, a storage device 110, and a bus115. The processor 105 is coupled to the storage device 110 by the bus115. In addition, a number of user input/output devices 120, such as akeyboard, mouse and display, are also coupled to the bus 115.

The processor 105 represents a central processing unit of any type ofarchitecture, such as Complex Instruction Set Computer (CISC), ReducedInstruction Set Computer (RISC), very long instruction word (VLIW), or ahybrid architecture (e.g., a combination of hardware and softwaretranslation). Also, the processor 105 could be implemented on one ormore chips. The storage device 110 represents one or more mechanisms forstoring data. For example, the storage device 110 may include read onlymemory (ROM), random access memory (RAM), magnetic disk storage mediums,optical storage mediums, flash memory devices, and/or othermachine-readable mediums. The bus 115 represents one or more buses(e.g., Accelerated Graphics Port “AGP”, Peripheral ComponentInterconnect “PCI”, Industry Standard Architecture “ISA”, ExtendedIndustry Standard Architecture “EISA”, Video Electronics StandardArchitecture “VESA” and the like) and bridges (also termed as buscontrollers). While this embodiment is described in relation to a singleprocessor computer system, the invention could be implemented in amulti-processor computer system.

In addition, while embodiments of the invention are herein described inrelation to 256-bit operands having 128-bit lanes, the invention is notlimited to a computer system with 128-bit lanes or 256-bit operands. Forexample, lanes could be comprised of but not limited to having 64 bits,and operands could independently be comprised of but not limited tohaving 512 bits.

Furthermore, devices including but not limited to one or more of anetwork 130, a TV broadcast signal receiver 131, a fax/modem 132, adigitizing unit 133, a sound unit 134, and a graphics unit 135 mayoptionally be coupled to bus 115. The network 130 represents one or morenetwork connections (e.g., an Ethernet connection). The TV broadcastsignal receiver 131 represents a device for receiving TV broadcastsignals, the fax/modem 132 represents a fax and/or modem for receivingand/or transmitting analog signals. The digitizing unit 133 representsone or more devices for digitizing images (e.g., a scanner, camera,etc.). The sound unit 134 represents one or more devices for inputtingand/or outputting sound (e.g., sound card, microphones, speakers,magnetic storage devices, optical storage devices, etc.). The graphicsunit 135 represents one or more devices for generating images (e.g.,graphics card).

FIG. 1 also illustrates that the storage device 110 has stored thereindata 140 and software 145. Data 140 represents data stored in one ormore of the formats described herein. Software 145 represents thenecessary code for performing any and/or all of the techniques inaccordance with the present invention. It will be recognized by one ofordinary skill in the art that the storage device 110 may containadditional software (not shown), which is not necessary to understandingthe invention.

FIG. 1 additionally illustrates that the processor 105 includes decodeunit 150, a set of registers 151, execution unit 152, and an internalbus 153 for executing instructions. It will be recognized by one ofordinary skill in the art that the processor 105 contains additionalcircuitry, which is not necessary to understanding the invention. Thedecode unit 150, registers 151 and execution unit 152 are coupledtogether by internal bus 153. The decode unit 150 is used for decodinginstructions received by processor 105 into control signals and/ormicrocode entry points. In response to these control signals and/ormicrocode entry points, the execution unit 152 performs the appropriateoperations. The decode unit 150 may be implemented using any number ofdifferent mechanisms (e.g., a look-up table, a hardware implementation,a programmable logic array “PLA”). Any mechanism for logicallyperforming decoding of the various instructions is considered to bewithin the scope of the implementation of the invention.

The decode unit 150 is shown including a packed data instruction set 160for performing operations on packed data. In one possible embodiment,the packed data instruction set 160 includes the shuffle instruction(s)164 for performing in-lane vector shuffle operations. The number formatfor the instructions can be any formant including signed and unsignedintegers, floating-point numbers, and non-numeric data. The operationsof these shuffle instructions are briefly described below and in greaterdetail with regard to FIGS. 2 a-2 c, 3 a-3 b, 5 a-5 c and 6 a-6 b.

One embodiment includes shuffling packed data elements according to asingle shuffle instruction 164 that specifies a field of per-lanecontrol bits, a single source operand and a destination operand. Thesource and destination operands each have corresponding multi-bit lanesthat may be divided into upper and lower portions, each including asimilar number of data elements. According to the field of per-lanecontrol bits, a substantially similar set of data elements can beselected from any data elements in corresponding portions of everymulti-bit lane of the source operand. Then each data element of theselected set can be copied, according to the field of per-lane controlbits, to any specified data fields located in corresponding portions ofevery multi-bit lane of the destination operand.

Alternatively a single shuffle instruction 164 specifies the field ofper-lane control bits, a first source operand, a second source operand,and a destination operand, all operands having corresponding multi-bitlanes, the corresponding multi-bit lanes having corresponding portions,each including a substantially similar number of data elements. Again,using a field of per-lane control bits, a set of data elements can beselected including data elements from every multi-bit lane portion ofthe first source operand and including data elements from everycorresponding multi-bit lane portion of the second source operand. Eachdata element of the selected set can then be copied to specifiedlocations in corresponding multi-bit lanes of the destination operand.

In addition to the packed data instructions, processor 105 can includenew instructions and/or instructions similar to or the same as thosefound in existing general purpose processors. For example, in oneembodiment, the processor 105 supports an instruction set which iscompatible with the Intel® Architecture instruction set used in thePentium® processors and/or Core™ processors.

It will be appreciated that as in some instructions of the Intel®Architecture instruction set and in some embodiments of shuffleinstruction 164, a source operand and a destination operand as describedherein may, in fact, be the same operand and source data may beoverwritten by destination data in that operand. Alternative embodimentsof the invention may contain more or less, as well as different, packeddata instructions and still utilize the teachings of the invention.

The registers 151 represent a storage area on processor 105 for storinginformation, including control/status information, integer data,floating point data, and packed data. It will be understood by one ofordinary skill in the art that one aspect of the invention is thedescribed instruction set for operating on packed data as well as howthe instructions are used. According to these aspects of the invention,the storage area used for storing the packed data is not critical. Theterm data processing system is used herein to refer to any machine forprocessing data, including the computer systems(s) described withreference to FIG. 1.

While one embodiment of the invention is described below with regard toFIGS. 5 b-5 c, in which the processor 105, executing the packed datainstructions operates on 256-bit packed data operands containing sixteen16-bit packed data elements called “words,” the processor 105 canoperate on packed data in several different packed data formats. Forexample, in one embodiment, packed data can be operated on a “byte”format or a “double word” (dword) format. The packed byte formatincludes thirty-two separate 8-bit data elements and the packed dwordformat includes eight separate 32-bit data elements, for example asshown in FIG. 5 a. While certain instructions are discussed below withreference to integer data, the instructions may be applied to otherpacked data formats as well. The 32-bit data elements shown in FIG. 5 aor as shown in FIG. 6 b may represent packed single-precisionfloating-point data, for example, and 64-bit data elements shown in FIG.6 a may be understood to represent packed double-precisionfloating-point data.

FIG. 2 a illustrates a flow diagram for one embodiment of a process toperform a shuffle instruction 164 according to one embodiment of theinvention. In this embodiment, the shuffle instruction 164. Process 201and other processes herein disclosed are performed by processing blocksthat may comprise dedicated hardware or software or firmware operationcodes executable by general purpose machines or by special purposemachines or by a combination of both.

This embodiment includes shuffling packed data elements according to asingle shuffle instruction 164 that specifies a field of per-lanecontrol bits 7-0, a single source operand and a destination operand. Thesource operand is accessed in processing block 220. The source anddestination operands each have corresponding multi-bit lanes. For oneembodiment these multi-bit lanes are each 128-bit lanes each including asimilar number of (e.g. in this case four) data elements. According tothe field of per-lane control bits 7-0 and the VSHUFD shuffleinstruction 164 of processing block 225, a substantially similar set ofdata elements is selected from any data elements D-A and from any dataelements H-E in each 128-bit lane of the source operand. Then inprocessing block 229 each data element of the selected set is copied,according to the field of per-lane control bits 7-0, to any data fieldslocated in corresponding portions of each 128-bit lane of thedestination operand as specified according to the VSHUFD shuffleinstruction 164.

FIG. 2 b illustrates a flow diagram for one embodiment of a process 202to perform a shuffle instruction 164 according to an alternativeembodiment of the invention. This embodiment includes shuffling packeddata elements according to a single shuffle instruction 164 that againspecifies a field of per-lane control bits 7-0, a single source operandand a destination operand. The source operand is accessed in processingblock 240. The source and destination operands each have correspondingmulti-bit lanes. For example, in this case these multi-bit lanes areeach 128-bit lanes that may be divided into upper and lower portions,each including a similar number of (e.g. in this case four) dataelements. According to the field of per-lane control bits 7-0 and theVSHUFLW shuffle instruction 164 of processing block 245, a substantiallysimilar set of data elements is selected from any data elements D-A andfrom any data elements H-E in corresponding lower portions of each128-bit lane of the source operand. Then in processing block 249 eachdata element of the selected set is copied, according to the field ofper-lane control bits 7-0, to any data fields located in correspondingportions of each 128-bit lane of the destination operand as specifiedaccording to the VSHUFLW shuffle instruction 164. The higher portions ofeach 128-bit lane of the source operand (in this case bits 255-192 andbits 127-64) are copied to corresponding higher portions of each 128-bitlane of the destination operand.

FIG. 2 c illustrates a flow diagram for one embodiment of a process 203to perform a shuffle instruction 164 according to another alternativeembodiment of the invention. This embodiment includes shuffling packeddata elements according to a single shuffle instruction 164 that alsospecifies a field of per-lane control bits 7-0, a single source operandand a destination operand. The source operand is accessed in processingblock 250. Again the source and destination operands each havecorresponding multi-bit lanes, which are both 128-bit lanes in thiscase, that may be divided into upper and lower portions, each includinga similar number (e.g. four) of data elements. According to the field ofper-lane control bits 7-0 and the VSHUFHW shuffle instruction 164 ofprocessing block 255, a substantially similar set of data elements isselected from any data elements D-A and from any data elements H-E incorresponding higher portions of each 128-bit lane of the sourceoperand. Then in processing block 259 each data element of the selectedset is copied, according to the field of per-lane control bits 7-0, toany data fields located in corresponding portions of each 128-bit laneof the destination operand as specified according to the VSHUFHW shuffleinstruction 164. The lower portions of each 128-bit lane of the sourceoperand (in this case bits 191-128 and bits 63-0) are copied tocorresponding lower portions of each 128-bit lane of the destinationoperand.

FIG. 3 a illustrates a flow diagram for one embodiment of a process 301to perform a shuffle instruction 164 according to another alternativeembodiment of the invention. This embodiment includes shuffling packeddata elements according to a single shuffle instruction 164 thatspecifies a field of per-lane control bits 3-2 and bits 1-0, a firstsource operand, a second source operand, and a destination operand. Thefirst source operand, S1, is accessed in processing block 380A. Thesecond source operand, S2, is accessed in processing block 380B. Alloperands have corresponding multi-bit lanes, which are 128-bit lanes inthis case, each multi-bit lane includes a substantially similar number(e.g. two) of data elements. According to the field of per-lane controlbits 3-2, bits 1-0 and the VSHUFPD shuffle instruction 164 of processingblock 385, a set of data elements can be selected including dataelements (X1 or X2 and X3 or X4) from the 128-bit lanes of the firstsource operand and data elements (Y1 or Y2 and Y3 or Y4) from the128-bit lanes of the second source operand. Then in processing block 389each data element of the selected set is copied to locations incorresponding 128-bit lanes of the destination operand as specifiedaccording to the VSHUFPD shuffle instruction 164.

FIG. 3 b illustrates a flow diagram for one embodiment of a process 302to perform a shuffle instruction 164 according to another alternativeembodiment of the invention. This embodiment includes shuffling packeddata elements according to a single shuffle instruction 164 thatspecifies a field of per-lane control bits 7-0, a first source operand,a second source operand, and a destination operand. The first sourceoperand, S1, is accessed in processing block 390A. The second sourceoperand, S2, is accessed in processing block 390B. All operands havecorresponding multi-bit lanes, which are 128-bit lanes in this case,each multi-bit lane includes a substantially similar number (e.g. four)of data elements. According to the single field of per-lane control bits7-0 and the VSHUFPS shuffle instruction 164 of processing block 395, aset of data elements can be selected including corresponding dataelements (X1-X4 or X5-X8) from every 128-bit lane of the first sourceoperand and including corresponding data elements (Y1-Y4 or Y5-Y8) fromevery 128-bit lane of the second source operand. Then in processingblock 399 each data element of the selected set is copied to locationsin corresponding 128-bit lanes of the destination operand as specifiedaccording to the VSHUFPS shuffle instruction 164.

FIG. 4 illustrates an example of a control word, imm8, to specify afield of per-lane control bits up to bits 7-0. As described above,embodiments of shuffle instruction 164 may specify a field of per-lanecontrol bits, one or more source operands, and a destination operand,wherein the field of per-lane control bits is specified by a portion ofan 8-bit immediate operand, imm8. It will be appreciated that byspecifying the field of per-lane control bits as described a longercontrol word is not needed to handle operands where more data fields arepermitted. Therefore decoding hardware may be less complex and hencefaster, and the sizes of execution units may be more proportional to thenumber of data fields that are permitted rather than to the square ofthat number.

FIG. 5 a illustrates the operation of the shuffle instruction 164 inaccordance with an embodiment of the invention. This embodiment includesshuffling packed data elements in an execution unit 152 responsive tothe decoding, in decode unit 150, of a single shuffle instruction 164that specifies a field of per-lane control bits 7-0, a single sourceoperand 520 and a destination operand 529. Source operand 520 anddestination operand 529 each have corresponding multi-bit lanes. For oneembodiment the multi-bit lanes are all 128-bit lanes each including asimilar number of (e.g. in this case four) data elements.

Responsive to the decoding of the VSHUFD shuffle instruction 164 asubstantially similar set of data elements is selected from any dataelements D-A by the 4:1 multiplexers 424-421 and from any data elementsH-E by the 4:1 multiplexers 528-525 in each 128-bit lane of sourceoperand 520 according to the field of per-lane control bits 7-0. Usingthe outputs of the 4:1 multiplexers 524-521 and the 4:1 multiplexers528-525, data elements of the selected set are copied to any of the datafields located in corresponding 128-bit lanes of the destination operand529 as specified according to the VSHUFD shuffle instruction 164 and thefield of per-lane control bits 7-0.

FIG. 5 b illustrates the operation of the shuffle instruction 164 inaccordance with an alternative embodiment of the invention. Thisembodiment includes shuffling packed data elements in an execution unit152 responsive to the decoding, in decode unit 150, of a single shuffleinstruction 164 that again specifies a field of per-lane control bits7-0, a single source operand 540 and a destination operand 549. Thesource operand 540 and destination operand 549 each have correspondingmulti-bit lanes. For example, in this case these multi-bit lanes areeach 128-bit lanes that may be further divided into upper portions (e.g.bits 255-192 and 127-64) and lower portions (e.g. bits 191-128 and63-0), each including a similar number of (e.g. in this case four) dataelements.

Responsive to the decoding of the VSHUFLW shuffle instruction 164 asubstantially similar set of data elements is selected from any dataelements D-A by the 4:1 multiplexers 544-541 and from any data elementsH-E by the 4:1 multiplexers 548-545 in corresponding lower portions ofeach 128-bit lane of source operand 540 according to the field ofper-lane control bits 7-0. Using the outputs of the 4:1 multiplexers544-541 and the 4:1 multiplexers 548-545, data elements of the selectedset are copied to any of the data fields located in corresponding lowerportions of each 128-bit lane of the destination operand 549 asspecified according to the VSHUFLW shuffle instruction 164 and the fieldof per-lane control bits 7-0. The higher portions of each 128-bit laneof source operand 540 (e.g. bits 255-192 and 127-64) are copied tocorresponding higher portions of each 128-bit lane of destinationoperand 549.

FIG. 5 c illustrates the operation of the shuffle instruction 164 inaccordance with another alternative embodiment of the invention. Thisembodiment includes shuffling packed data elements in an execution unit152 responsive to the decoding, in decode unit 150, of a single shuffleinstruction 164 that also specifies a field of per-lane control bits7-0, a single source operand 550 and a destination operand 559. Thesource operand 550 and destination operand 559 each have correspondingmulti-bit lanes. For example, in this case these multi-bit lanes areeach 128-bit lanes that may be further divided into upper portions (e.g.bits 255-192 and 127-64) and lower portions (e.g. bits 191-128 and63-0), each including a similar number of (e.g. four) data elements.

Responsive to the decoding of the VSHUFHW shuffle instruction 164 asubstantially similar set of data elements is selected from any dataelements D-A by the 4:1 multiplexers 554-551 and from any data elementsH-E by the 4:1 multiplexers 558-555 in corresponding higher portions ofeach 128-bit lane of source operand 550 according to the field ofper-lane control bits 7-0. Using the outputs of the 4:1 multiplexers554-551 and the 4:1 multiplexers 558-555, data elements of the selectedset are copied to any of the data fields located in corresponding higherportions of each 128-bit lane of the destination operand 559 asspecified according to the VSHUFHW shuffle instruction 164 and the fieldof per-lane control bits 7-0. The lower portions of each 128-bit lane ofsource operand 550 (e.g. bits 191-128 and 63-0) are copied tocorresponding lower portions of each 128-bit lane of destination operand559.

FIG. 6 a illustrates the operation of the shuffle instruction 164 inaccordance with another alternative embodiment of the invention. Thisembodiment includes shuffling packed data elements in an execution unit152 responsive to the decoding, in decode unit 150, of a single shuffleinstruction 164 that specifies a field of per-lane control bits 3-2 andbits 1-0, a first source operand 680A, a second source operand 680B, anda destination operand 689. First source operand 680A, second sourceoperand 680B, and destination operand 689 all have correspondingmulti-bit lanes, which are 128-bit lanes in this case, each multi-bitlane includes a substantially similar number (e.g. two) of dataelements.

Responsive to the decoding of the VSHUFPD shuffle instruction 164 a setof data elements can be selected including corresponding data elements(X1 or X2 and X3 or X4) from every 128-bit lane of first source operand680A by the 2:1 multiplexers 683 and 681 and including correspondingdata elements (Y1 or Y2 and Y3 or Y4) from every 128-bit lane of secondsource operand 680B by the 2:1 multiplexers 684 and 682 according to thefield of per-lane control bits 3-2 and bits 1-0. Using the outputs ofthe 2:1 multiplexers 684-681 data elements of the selected set arecopied to locations in corresponding 128-bit lanes of the destinationoperand 689 as specified according to the VSHUFPD shuffle instruction164 and the field of per-lane control bits 3-2 and bits 1-0.

FIG. 6 b illustrates the operation of the shuffle instruction 164 inaccordance with another alternative embodiment of the invention. Thisembodiment includes shuffling packed data elements in an execution unit152 responsive to the decoding, in decode unit 150, of a single shuffleinstruction 164 that specifies a single field of per-lane control bitsbits 7-0, a first source operand 690A, a second source operand 690B, anda destination operand 699. First source operand 690A, second sourceoperand 690B, and destination operand 699 all have correspondingmulti-bit lanes, which are 128-bit lanes in this case, each multi-bitlane includes a substantially similar number (e.g. four) of dataelements.

Responsive to the decoding of the VSHUFPS shuffle instruction 164 a setof data elements can be selected including corresponding data elements(X1-X4 or X5-X8) from every 128-bit lane of first source operand 690A bythe 4:1 multiplexers 691-692 and 695-696 and including correspondingdata elements (Y1-Y4 or Y5-Y8) from every 128-bit lane of second sourceoperand 690B by the 4:1 multiplexers 693-694 and 697-698 according tothe field of per-lane control bits 7-0. Using the outputs of the 4:1multiplexers 698-691 data elements of the selected set are copied tolocations in corresponding 128-bit lanes of the destination operand 689as specified according to the VSHUFPS shuffle instruction 164 and thefield of per-lane control bits 7-0.

The above description is intended to illustrate preferred embodiments ofthe present invention. From the discussion above it should also beapparent that especially in such an area of technology, where growth isfast and further advancements are not easily foreseen, the invention maybe modified in arrangement and detail by those skilled in the artwithout departing from the principles of the present invention withinthe scope of the accompanying claims and their equivalents.

1. A computer implemented method for shuffling packed data elementscomprising: decoding a single instruction specifying a single field ofper-lane control bits, a source operand and a destination operand, saidsource and destination operands having corresponding pluralities ofmulti-bit lanes, each multi-bit lane being divided into correspondingpluralities of portions, each of said corresponding portions including asubstantially similar plurality of data elements; responsive to decodingthe single instruction and the single field of per-lane control bits,selecting a substantially similar set of data elements from any dataelements in the corresponding portions of every multi-bit lane of thesource operand; and copying each data element of the selected set ofdata elements to any specified data fields located in the correspondingportions of every multi-bit lane of the destination operand.
 2. Themethod of claim 1, wherein the corresponding portions are either theupper halves or the lower halves of each of said plurality of multi-bitlanes of the source and destination operands.
 3. The method of claim 2,wherein the multi-bit lanes are 128-bit lanes.
 4. The method of claim 2,wherein the data elements are 16-bit data elements.
 5. The method ofclaim 1, wherein the source operand and the destination operand are thesame operand.
 6. The method of claim 1, wherein said source anddestination operands are 256-bit operands.
 7. A computer implementedmethod for shuffling packed data elements comprising: decoding a singleinstruction specifying a field of per-lane control bits, a first sourceoperand, a second source operand, and a destination operand, said firstsource, second source and destination operands having correspondingpluralities of multi-bit lanes, the corresponding multi-bit lanes havingcorresponding portions each including a substantially similar pluralityof data elements; responsive to decoding the single instruction and thefield of per-lane control bits, selecting a set of data elementscomprised of data elements from every multi-bit lane portion of thefirst source operand and data elements from every correspondingmulti-bit lane portion of the second source operand according to thefield of per-lane control bits; and copying each data element of theselected set of data elements to a specified data field located in everycorresponding multi-bit lane of the destination operand.
 8. The methodof claim 7, wherein the specified data field is either the lower half orthe upper half of each of said plurality of multi-bit lanes of thedestination operand according to whether the data element of theselected set was selected from the corresponding multi-bit lane of thefirst source operand or of the second source operand respectively. 9.The method of claim 7, wherein the first source operand and thedestination operand are the same operand.
 10. The method of claim 7,wherein the multi-bit lanes are 128-bit lanes.
 11. The method of claim10, wherein the data elements are 64-bit data elements.
 12. The methodof claim 10, wherein the data elements are 32-bit data elements.
 13. Themethod of claim 12, wherein the set of data elements selected accordingto the field of per-lane control bits comprises corresponding dataelements from every multi-bit lane of the first source operand andcorresponding data elements from every multi-bit lane of the secondsource operand.
 14. The method of claim 10, wherein said source anddestination operands are 256-bit operands.
 15. A processor comprising: adecode unit to decode a single instruction specifying a single field ofper-lane control bits, a source operand and a destination operand, saidsource and destination operands having corresponding pluralities ofmulti-bit lanes, each multi-bit lane being divided into correspondingpluralities of portions, each of said corresponding portions including asubstantially similar plurality of data elements; an execution unitresponsive to said decoding of the single instruction and the singlefield of per-lane control bits, to select a substantially similar set ofdata elements from any data elements in the corresponding portions ofevery multi-bit lane of the source operand, and to copy each dataelement of the selected set of data elements to any specified datafields located in the corresponding portions of every multi-bit lane ofthe destination operand.
 16. The processor of claim 15, wherein thecorresponding portions are either the upper halves or the lower halvesof each of said plurality of multi-bit lanes of the source anddestination operands.
 17. The processor of claim 15, wherein themulti-bit lanes are 128-bit lanes.
 18. The processor of claim 17,wherein the data elements are 16-bit data elements.
 19. The processor ofclaim 18, wherein the source operand and the destination operand are thesame operand.
 20. The processor of claim 19, wherein said source anddestination operands are 256-bit operands.
 21. A processor comprising: adecode unit to decode a single instruction specifying a field ofper-lane control bits, a first source operand, a second source operand,and a destination operand, said first source, second source anddestination operands having corresponding pluralities of multi-bitlanes, the corresponding multi-bit lanes having corresponding portionseach including a substantially similar plurality of data elements; anexecution unit responsive to decoding of the single instruction and thefield of per-lane control bits, selecting a set of data elementscomprised of data elements from every multi-bit lane portion of thefirst source operand and of data elements from every correspondingmulti-bit lane portion of the second source operand according to thefield of per-lane control bits, and to copy each data element of theselected set of data elements to a specified data field located in everycorresponding multi-bit lane of the destination operand.
 22. Theprocessor of claim 21, wherein the multi-bit lanes are 128-bit lanes.23. The processor of claim 22, wherein the data elements are 64-bit dataelements.
 24. The processor of claim 22, wherein the data elements are32-bit data elements.
 25. The processor of claim 24, wherein the set ofdata elements selected according to the field of per-lane control bitscomprises corresponding data elements from every multi-bit lane of thefirst source operand and corresponding data elements from everymulti-bit lane of the second source operand.
 26. The processor of claim25, wherein said first and second source operands and destinationoperand are 256-bit operands
 27. The processor of claim 26, wherein thefirst source operand and the destination operand are the same operand.